import bisect


class Solution(object):
    def canEat(self, candiesCount, queries):
        n = len(candiesCount)
        m = len(queries)
        ans = [False] * m
        for i in range(1, n):
            candiesCount[i] += candiesCount[i - 1]
        for index, (type, day, f) in enumerate(queries):
            start_index = bisect.bisect_right(candiesCount, day)
            if start_index > type:
                ans[index] = False
            else:
                end_index = bisect.bisect_left(candiesCount, f * (day + 1))
                if end_index >= type:
                    ans[index] = True
                else:
                    ans[index] = False
        return ans


data = Solution()
can = [46, 5, 47, 48, 43, 34, 15, 26, 11, 25, 41, 47, 15, 25, 16, 50, 32, 42, 32, 21, 36, 34, 50, 45, 46, 15, 46, 38,
       50, 12, 3, 26, 26, 16, 23, 1, 4, 48, 47, 32, 47, 16, 33, 23, 38, 2, 19, 50, 6, 19, 29, 3, 27, 12, 6, 22, 33, 28,
       7, 10, 12, 8, 13, 24, 21, 38, 43, 26, 35, 18, 34, 3, 14, 48, 50, 34, 38, 4, 50, 26, 5, 35, 11, 2, 35, 9, 11, 31,
       36, 20, 21, 37, 18, 34, 34, 10, 21, 8, 5]
q = [[85,54,42]]
print(data.canEat(can, q))
